#include "mobilefilelistdelegate.h"
#include <QPainter>
#include <QDebug>

#include "mobilefilelistview.h"

const int ITEM_LIST_MODE_HEIGHT = 52;
const int ITEM_ICON_MODE_WIDTH = 96;
const int ITEM_ICON_MODE_HEIGHT = 96;

MobileFileListDelegate::MobileFileListDelegate(QAbstractItemView *parent) : KListViewDelegate(parent) {}

MobileFileListDelegate::~MobileFileListDelegate() {}

QSize MobileFileListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
//    Q_UNUSED(index);
    auto *listView = qobject_cast<const MobileFileListView *>(option.widget);

    if (listView->viewMode() == QListView::IconMode) {
        return QSize(ITEM_ICON_MODE_WIDTH, ITEM_ICON_MODE_HEIGHT);
    } else {
        auto size = KListViewDelegate::sizeHint(option, index);
        return QSize(size.width(), ITEM_LIST_MODE_HEIGHT);
    }
}
